/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Estacionamento.ClassesBasicas;

/**
 *
 * @author Italo Valença
 */
import java.util.*;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
public class Cliente {

    @Id
    @GeneratedValue
    private long id;
    private String nome;
    private double telefone;
    private String cpfCnpj;
    private Endereco endereco;
    @OneToMany(mappedBy = "cliente", fetch = FetchType.LAZY)
    @Cascade(CascadeType.ALL)
    private List<Veiculo> veiculos;
    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "Cliente_Plano", schema = "estacionamento_praticodb", joinColumns = @JoinColumn(name = "id_cliente"), inverseJoinColumns = @JoinColumn(name = "id_plano"))
    @Cascade(CascadeType.ALL)
    private List<Plano> plano;

    public Cliente() {
        // TODO Auto-generated constructor stub
    }

    public Cliente(String nome, double telefone, String cpfCnpj,
            Endereco endereco, List<Veiculo> veiculos,
            List<Plano> plano) {
        super();
        this.nome = nome;
        this.telefone = telefone;
        this.cpfCnpj = cpfCnpj;
        this.endereco = endereco;
        this.veiculos = veiculos;
        this.plano = plano;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getCpfCnpj() {
        return cpfCnpj;
    }

    public void setCpfCnpj(String cpfCnpj) {
        this.cpfCnpj = cpfCnpj;
    }

    public List<Plano> getPlano() {
        return plano;
    }

    public void setPlano(List<Plano> plano) {
        this.plano = plano;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public double getTelefone() {
        return telefone;
    }

    public void setTelefone(double telefone) {
        this.telefone = telefone;
    }

    public Endereco getEndereco() {
        return endereco;
    }

    public void setEndereco(Endereco endereco) {
        this.endereco = endereco;
    }

    public List<Veiculo> getVeiculo() {
        return veiculos;
    }

    public void setVeiculo(List<Veiculo> veiculos) {
        this.veiculos = veiculos;
    }

}
